package com.shanzmoo.platform.tomerchant.api.service;

import com.shanzmoo.platform.tomerchant.api.manager.MerchantInfoManage;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;

/**
 * 自定义 UserDetailsService
 *
 * @author: Gzhao 2020/11/9
 */
@Slf4j
@Service
@RequiredArgsConstructor
public class AuthUserDetailsService implements UserDetailsService {
    private final MerchantInfoManage merchantInfoManage;

    @Override
    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
        return merchantInfoManage.findByUserName(username);
    }
}
